<%@tag language="java" pageEncoding="utf-8" %>
<%@attribute name="page" type="com.xianzhi.util.Page" required="true" %>
<%@attribute name="jsMethodName" type="java.lang.String" required="true" %>
<script>
    function turnsCurrentPage(currentPage) {
        //使用正则表达示验证currentPage是否是数字
        var rule = /^[0-9]*[1-9][0-9]*$/
        //如果不是数字就将currentPage设置为1
        if(!rule.test(currentPage)){
            currentPage = 1;
        }
        //解析并调用js中的方法(eval+方法名)
        eval("${jsMethodName}(currentPage)");
    }
</script>

<div class="page fix">
    <a href="javascript:turnsCurrentPage('1')" class="first">首页</a>
    <a href="javascript:turnsCurrentPage('${page.currentPage-1}')" class="pre">上一页</a>
    当前第 <span>${page.currentPage}/${page.totalPage}</span>
    <a href="javascript:turnsCurrentPage('${page.currentPage+1}')" class="next">下一页</a>
    <a href="javascript:turnsCurrentPage('${page.totalPage}')" class="last">末页</a>
    跳至 <input id="currentPageText" type="text" value="1" class="allInput w28">页
    <a href="javascript:turnsCurrentPage($('#currentPageText').val())" class="go">GO</a>
</div>